import { createRouter, createWebHashHistory } from 'vue-router'

const router = createRouter({
    history: createWebHashHistory(),
    routes: [
        {
            path: '/',
            component: () => import('../App.vue'),
            redirect: { name: 'index' },
            children: [
                {
                    path: '/layout',
                    name: 'layout',
                    component: () => import('views/layout.vue'),
                    children: [
                        {
                            path: '/index',
                            name: 'index',
                            component: () => import('views/index.vue'),
                        },
                        {
                            path: '/oneImage/:page',
                            name: 'oneImage',
                            props: true,
                            component: () => import('views/oneImage.vue'),
                        },
                        {
                            path: '/welfare',
                            name: 'welfare',
                            component: () => import('views/welfare.vue')
                        },
                        {
                            path: '/poster',
                            name: 'poster',
                            component: () => import('views/poster.vue'),
                        }
                    ]
                },
                {
                    path: '/admin',
                    name: 'admin',
                    component: () => import('views/admin/layout.vue'),
                    redirect: { name: 'adminMoreImage', params: { page: 'index' } },
                    children: [
                        {
                            path: '/admin/moreImage/:page',
                            name: 'adminMoreImage',
                            props: true,
                            component: () => import('views/admin/moreImage.vue')
                        },
                        {
                            path: '/admin/oneImage/:page',
                            name: 'adminOneImage',
                            props: true,
                            component: () => import('views/admin/oneImage.vue')
                        }
                    ]
                }
            ]
        }
    ]
})

export default router
